package com.ocean.clearance.conf;

import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate.ConfirmCallback;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class MsgSendConfirmCallBack implements ConfirmCallback{

	/**
	 * 如果到了exchange交换机，那么ack为成功
	 */
	@Override
	public void confirm(CorrelationData correlationData, boolean ack, String cause) {

		log.info(" 回调消息id:" + correlationData);
		log.debug("消息发送到exchange成功,id: {}", correlationData.getId());
		if (ack) {
			log.info("CallBackConfirm 消息消费成功！");
		} else {
			log.info("CallBackConfirm 消息消费失败！");
		}
	}

}
